<?php
// +----------------------------------------------------------------------
// | Citrix [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://www.tpCitrix.com/ All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.tpCitrix.com/ )
// +----------------------------------------------------------------------
// | Author: Citrix < 2722279500@qq.com >
// +----------------------------------------------------------------------

namespace app\index\controller;

use \think\Db;
use \think\Cache;
use \think\Cookie;
use \think\Session;
use app\index\controller\Base;
class Index extends Base
{
    public function index()
    {
        $this->assign('cur','index');
        //文章分类
        $article = Db::name('article_cate')->where('is_top',1)->order('top_sort DESC')->limit(0,3)->select();
        if(!empty($article))
        {
        	//文章
        	$article_model = Db::name('article');
        	foreach ($article as $key => $value) 
        	{
        		$article[$key]['list'] = $article_model->where(['is_top'=>1,'status'=>1,'article_cate_id'=>$article[$key]['id']])->order('top_sort DESC')->limit(0,4)->select();
        	}
        }
        //商品
        $goods = Db::name('goods')->where(['is_top'=>1,'status'=>1])->order('top_sort DESC')->limit(0,5)->select();
        //下载
        $download = Db::name('download')->where(['is_top'=>1,'status'=>1])->order('top_sort DESC')->limit(0,3)->select();
        //友情链接
        $link = Db::name('link')->order('show_order DESC')->select();
        $this->assign('link',$link); 
        $this->assign('download',$download); 
        $this->assign('goods',$goods); 
        $this->assign('article',$article);        
        return $this->fetch();
    }

}
